package com.bank.dao.impl;

import com.bank.dao.DBUtil;
import com.bank.dao.Interface.QueryDao;
import com.bank.model.BankCard;
import com.bank.model.Transaction;
import com.bank.model.User;

import java.util.List;


public class QueryDaoImpl extends DBUtil implements QueryDao {
    @Override
    public BankCard queryTb_Bankcard(String bank_id) {//查询银行卡表
        String sql="SELECT * FROM tb_bankcard WHERE bank_id=?;";
        BankCard bankCard =super.executeQueryOne(sql, BankCard.class, bank_id);
        return bankCard;
    }

    @Override
    public User queryTb_User(Integer card_id) {//查询用户表
        String sql="SELECT * FROM tb_user WHERE card_id=?;";
        User user=super.executeQueryOne(sql, User.class, card_id);
        return user;
    }

    @Override
    public List<Transaction> queryTb_Transaction(Integer card_id) {
        String sql="SELECT * FROM tb_transaction WHERE card_id=?;";
        List<Transaction> transactions = super.executeQueryList(sql, Transaction.class, card_id);
        return transactions;
    }
}
